﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using BLL;
using Model;

public partial class ViewbyProduct_ViewProductState_PackagebyProductSN : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindPackageProduct();
        }
    }

    private void BindPackageProduct()
    {
        PackageProduct testItem = new PackageProduct();
        string str1 = (string)Session["productSN"];
        //string str1 = Request.QueryString["ProductSN"];
        //this.TextBox1.Text = str1;
        if (str1 != null)
        {
            IList<PackageProductInfo> ppis = new List<PackageProductInfo>();
            PackageProductInfo ppi = testItem.GetAllPackagebyProductSN(str1);
            ppis.Add(ppi);
            GridView1.DataSource = ppis;
            GridView1.DataBind();
            foreach (GridViewRow dr in GridView1.Rows)
            {
                if (Convert.ToDateTime(GridView1.DataKeys[dr.RowIndex].Values[0]) == DateTime.MinValue)
                    dr.Cells[4].Text = ""; ;
                if (Convert.ToDateTime(GridView1.DataKeys[dr.RowIndex].Values[1]) == DateTime.MinValue)
                    dr.Cells[7].Text = "";
            }
        }
    }
}
